package javase.simple_factory.interface_method;

class SimpleFactory {
    public static Car createObject(String s){
        if (s.equals("BWM"))
             return new BWM();
        else if (s.equals("Benz"))
            return new Benz();
        return null;
    }

    public static void main(String[] args) {
        Car bwm = SimpleFactory.createObject("BWM");
        bwm.run();
        Car benz = SimpleFactory.createObject("Benz");
        benz.run();
    }
}
